package org.sy.lab.多线程基础._3_同步辅助类._4_Phaser阶段器;

import java.util.concurrent.TimeUnit;

public class Fuel implements Runnable {
	
private Rocket rocket = new Rocket();
	
	public Fuel(Rocket rocket) {
		this.rocket = rocket;
	}
	
	@Override
	public void run() {
		
		try {
			
			TimeUnit.SECONDS.sleep((int)(Math.random()*5));
			rocket.first(Thread.currentThread().getName());
			
			TimeUnit.SECONDS.sleep((int)(Math.random()*5));
			rocket.secondRemove(Thread.currentThread().getName());
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
